Skip to content

[2.0.0] Fix dropped SSL connection when buffer gets full. #4821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 31, 2021

Conversation

everslick
Copy link
Contributor

mbedTLS requires repeated calls to mbedtls_ssl_write() whenever it returns MBEDTLS_ERR_SSL_WANT_READ or MBEDTLS_ERR_SSL_WANT_WRITE. this happens when the client sends data faster then the server or the connection can handle.

Fixes: #2494

mbedTLS requires repeated calls to mbedtls_ssl_write() whenever it returns MBEDTLS_ERR_SSL_WANT_READ or MBEDTLS_ERR_SSL_WANT_WRITE. this happens when the client sends data faster then the server or the connection can handle.

Fixes: espressif/arduino-esp32#2494
@everslick everslick changed the title Fix dropped SSL connection when buffer gets full. [2.0.0] Fix dropped SSL connection when buffer gets full. Feb 17, 2021
return handle_error(ret);
} else{
log_v("Returning with %d bytes written", ret); //for low level debug
while ((ret = mbedtls_ssl_write(&ssl_client->ssl_ctx, data, len)) <= 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit worried about such busy while loop. Add at least vTaskDelay(2); to ensure that task switching will work

Add vTaskDelay()
@VojtechBartoska VojtechBartoska added this to the 2.0.0 milestone Mar 2, 2021
@me-no-dev me-no-dev merged commit 33d8939 into espressif:idf-release/v4.2 Mar 31, 2021
me-no-dev pushed a commit that referenced this pull request Mar 31, 2021
* Fix dropped SSL connection when buffer gets full.

mbedTLS requires repeated calls to mbedtls_ssl_write() whenever it returns MBEDTLS_ERR_SSL_WANT_READ or MBEDTLS_ERR_SSL_WANT_WRITE. this happens when the client sends data faster then the server or the connection can handle.

Fixes: #2494

* Update ssl_client.cpp

Add vTaskDelay()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants